﻿<?php
	if (!$this->IsEmpty("SaveInfo"))
	{
?>
<div class="row">
	<div class="col-sm-offset-4 col-sm-4">
		<div class="panel panel-default info-text">
		<?= HTML::Write($this->SaveInfo); ?>
		</div>
	</div>
</div>
<?php
	}
?>

<!-- Angebot Details -->
<div class="row">
	<div class="panel-body">
	
		<!-- Bearbeiten der Daten -->
		<form id="data_edit" class="form-horizontal" method="POST" role="form">
			<!-- Hidden Values -->
			<input type="hidden" name="c" value="Angebot" />
			<input type="hidden" name="a" value="SaveAngebot" />
			<input type="hidden" name="a_id" value="<?= HTML::Write($this->Angebot->ID); ?>" />
			
			<!-- Name -->
			<div class="form-group string required angebot-name">
				<label class="col-sm-4 string required control-label" for="edit_angebot_name">Name</label>
				<div class="col-sm-6 controls">
					<input class="form-control string required" id="edit_angebot_name" name="a_name" type="text" value="<?= HTML::Write($this->Angebot->Name); ?>" required>
				</div>
			</div>
			
			<!-- Beschreibung -->
			<div class="form-group text optional angebot-beschreibung">
				<label class="col-sm-4 text optional control-label" for="edit_angebot_beschreibung">Beschreibung</label>
				<div class="col-sm-8 controls">
					<textarea class="form-control text required" id="edit_angebot_beschreibung" name="a_beschreibung" required><?= HTML::Write($this->Angebot->Beschreibung); ?></textarea>
				</div>
			</div>
			
			<!-- Speichern/Abbrechen -->
			<div class="form-group">
				<div class="col-sm-offset-4 col-sm-8">
					<button id="submit-edit" class="btn btn-primary" type="submit">Speichern</button>
					<button id="cancel-edit" type="reset" class="btn btn-danger" >Zurücksetzten</button>
				</div>
			</div>
		</form>
		
	</div>
</div>

<div class="row">
	<div class="col-sm-offset-2 col-sm-6">
<?php
	if (!$this->IsEmpty("AvailableProducts"))
	{
?>
		<form id="add_product_to_angebot" class="form-inline" method="POST" role="form">
			<!-- Hidden Values -->
			<input type="hidden" name="c" value="Angebot" />
			<input type="hidden" name="a" value="AddProdukt" />
			<input type="hidden" name="a_id" value="<?= HTML::Write($this->Angebot->ID); ?>" />
			
			<!-- Name -->
			<div class="form-group string required angebot-name">
	<?php
				echo HTML::DropDownFor($this->AvailableProducts, "", "ID", "Name", "Produkt auswählen",
										array(
											"id" => "add_produkt_angebot"
											, "class" => "form-control requirede add-produkt-angebot"
											, "name" => "a_produkt"
										), true);
	?>
			</div>
			
			<!-- Speichern/Abbrechen -->
			<div class="form-group">
				<button id="submit-edit" class="btn btn-primary" type="submit"><?= HTML::Write("zu Angebot Hinzufügen"); ?></button>
			</div>
		</form>
<?php
	}
?>
	</div>
</div>

<!-- Dummy Row für den Abstand -->
<div class="row">&nbsp;</div>

<!-- Produkte in dem Angebot -->
<div class="row">
<?php
	if (!$this->IsEmpty("Produkte"))
		echo $this->View("angebot_product_liste");
?>
</div>